#ifndef __CONFIG_BOOT_H__
#define __CONFIG_BOOT_H__

#include "cJSON.h"

#define BOOT_PARAMENT_NAME "boot"
#define BOOT_PARAMENT_SIZE (4096)

#define UBOOT_CFG "uboot"
#define UMODEM_UART "ym_uart"
#define YM_WAIT_TIME "ym_time"
#define UBOOT_MODE "mode"
#define OTA_STATE "ota_state"
#define OTA_SIZE "ota_size"

// 等待0S输入
#define BOOT_YMODE_WAIT_TIME 0

typedef struct
{
    unsigned char ymode_uart[8];
    unsigned char ymode_wait_time;
    unsigned char uboot_mode; // function flag
    unsigned char ota_state;
    unsigned char na;
    unsigned int ota_size;
} uboot_cfg_t;

int get_boot_param(uboot_cfg_t *boot_parament);
int set_boot_param(uboot_cfg_t *boot_parament);
int parse_uboot_cfg(const cJSON *data_json, uboot_cfg_t *uboot_cfg);
int add_uboot_cfg(cJSON *data_json, const uboot_cfg_t *uboot_cfg);
uboot_cfg_t *uc_get_uboot_cfg(void);
void uc_set_uboot_cfg(uboot_cfg_t *uboot_cfg);
#endif